package com.hiultra.archive.service.impl;

import java.util.List;

import cn.hutool.core.util.ObjectUtil;
import com.hiultra.archive.domain.ArchiveStorageBox;
import com.hiultra.archive.mapper.ArchiveStorageBoxMapper;
import com.hiultra.archive.service.IArchiveStorageBoxService;
import com.hiultra.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 档案入库档案盒Service业务层处理
 *
 * @author ruoyi
 * @date 2024-07-22
 */
@Service
public class ArchiveStorageBoxServiceImpl implements IArchiveStorageBoxService
{
    @Autowired
    private ArchiveStorageBoxMapper archiveStorageBoxMapper;

    /**
     * 查询档案入库档案盒
     *
     * @param id 档案入库档案盒主键
     * @return 档案入库档案盒
     */
    @Override
    public ArchiveStorageBox selectArchiveStorageBoxById(String id)
    {
        return archiveStorageBoxMapper.selectArchiveStorageBoxById(id);
    }

    /**
     * 查询档案入库档案盒列表
     *
     * @param archiveStorageBox 档案入库档案盒
     * @return 档案入库档案盒
     */
    @Override
    public List<ArchiveStorageBox> selectArchiveStorageBoxList(ArchiveStorageBox archiveStorageBox)
    {
        return archiveStorageBoxMapper.selectArchiveStorageBoxList(archiveStorageBox);
    }

    /**
     * 新增档案入库档案盒
     *
     * @param archiveStorageBox 档案入库档案盒
     * @return 结果
     */
    @Override
    public int insertArchiveStorageBox(ArchiveStorageBox archiveStorageBox)
    {
        archiveStorageBox.setCreateTime(DateUtils.getNowDate());
        return archiveStorageBoxMapper.insertArchiveStorageBox(archiveStorageBox);
    }

    /**
     * 修改档案入库档案盒
     *
     * @param archiveStorageBox 档案入库档案盒
     * @return 结果
     */
    @Override
    public int updateArchiveStorageBox(ArchiveStorageBox archiveStorageBox)
    {
        return archiveStorageBoxMapper.updateArchiveStorageBox(archiveStorageBox);
    }

    /**
     * 批量删除档案入库档案盒
     *
     * @param ids 需要删除的档案入库档案盒主键
     * @return 结果
     */
    @Override
    public int deleteArchiveStorageBoxByIds(String[] ids)
    {
        return archiveStorageBoxMapper.deleteArchiveStorageBoxByIds(ids);
    }

    /**
     * 删除档案入库档案盒信息
     *
     * @param id 档案入库档案盒主键
     * @return 结果
     */
    @Override
    public int deleteArchiveStorageBoxById(String id)
    {
        return archiveStorageBoxMapper.deleteArchiveStorageBoxById(id);
    }

    /**
     * 根据任务id查询盒详情
     * @param taskId
     * @return
     */
    @Override
    public List<ArchiveStorageBox> selectArchiveStorageBoxByTaskId(String taskId) {
        return archiveStorageBoxMapper.selectArchiveStorageBoxByTaskId(taskId);
    }

    /**
     * 批量新增档四案入库档案盒
     *
     * @param archiveStorageBoxList 档案入库档案盒
     * @return 结果
     */
    @Override
    public int batchInsertArchiveStorageBox(List<ArchiveStorageBox> archiveStorageBoxList){
        if(ObjectUtil.isEmpty(archiveStorageBoxList)){
            return 0;
        }
        return archiveStorageBoxMapper.batchInsertArchiveStorageBox(archiveStorageBoxList);
    }

}
